const express = require("express");
const router = express.Router();
const { getIndex } = require("../service/get-index");
const { result } = require("../util/util");
/**
 * 得到首页分类
 */
router.get("/", async (req, res, next) => {
	try {
		let { page, pageSize } = req.query || {};
		let data = await getIndex({ page });
		res.json(
			result({
				d: data.data.data
			})
		);
	} catch (err) {
		res.json(
			result({
				s: 0,
				m: err
			})
		);
	}
});

module.exports = router;
